package com.example.bootintegration.configuration;

import com.example.bootintegration.datasource.DataSourceRegistrar;
import com.example.bootintegration.datasource.PrimaryDataSourceProcessor;
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * 用于创建DataSource对象，同时设置一个primary
 *
 * @author Quintoy
 * @date 12/30/22
 */
@Configuration("myDatasourceConfiguration")
@EnableTransactionManagement
@Import(DataSourceRegistrar.class)
public class DataSourceConfiguration {

    @Bean
    public BeanDefinitionRegistryPostProcessor primaryDatasource() {
        return new PrimaryDataSourceProcessor();
    }



}
